<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<mesoBoard.Data.Category>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <% IEnumerable<mesoBoard.Web.Models.ForumRow> forumRows = ViewData["Forums"] as IEnumerable<mesoBoard.Web.Models.ForumRow>; %>
    <div class="bread_crumb">
        <%= Html.BoardIndexLink("Board Index", "", true) %>
    </div>

    <% foreach (var cat in Model.OrderBy(x => x.Order)) { %>
        <table class="forums_index">
            <tr>
                <td colspan="4" class="category_header"><%= cat.Name%></td>
            </tr>

            <% int i = 0;
               foreach (var forum in forumRows.Where(x => x.Forum.CategoryID == cat.CategoryID).OrderBy(x => x.Forum.Order))
               {
                   forum.IsOdd = i++ % 2 == 0;
                   Html.RenderPartial("ForumRow", forum);
               } %>

            <% if (cat.Forums.Count == 0)
               { %>
                <tr>
                    <td colspan="4" style="text-align: center">
                        No Forums
                    </td>
                </tr>
            <%} %>
        </table>       
    <%} %>

    <table class="form_table">
        <tr>
            <th style="width: 10%; text-align:center"><%= Html.ThemeImage("chart_bar.png") %></th>
            <td><% Html.RenderAction("BoardStats", "Board"); %></td>
        </tr>
    </table>

    <%= Html.Spacer(15) %>

    <table class="form_table">
        <tr>
            <th style="width: 10%; text-align:center"><%= Html.ThemeImage("cake.png") %></th>
            <td><% Html.RenderAction("UserBirthdays", "Members"); %></td>
        </tr>
    </table>

</asp:Content>
